#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
	int q;
	cin >> q;
	while (q--)
	{
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		int numsMin = min({ a, b, c });
		ll ans = 0;
		ans += 2 * numsMin;
		ll tmp = b - numsMin - 1;
		ans += tmp > 0 ? tmp : 0;
		cout << ans << endl;
	}
	return 0;
}